home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / internet / source / echo.cbl next >
Encoding:
Text File  |  1995-05-16  |  4.6 KB  |  131 lines

  1.        Process Apost DateTime.
  2.        Identification Division.
  3.        Program-Id.  ECHOCBL.
  4.  
  5.        Environment Division.
  6.        Configuration Section.
  7.        Source-Computer.  IBM-AS400.
  8.        Object-Computer.  IBM-AS400.
  9.  
  10.        Input-Output Section.
  11.        File-Control.
  12.  
  13.            Select ICF
  14.                             Assign to    Workstation-ECHOICF-SI
  15.                             Organization Transaction
  16.                             Status ICF-FD-Status, ICF-Major-Minor-Code.
  17.        I-O-Control.
  18.  
  19.        Data Division.
  20.        File Section.
  21.  
  22.        FD  ICF
  23.             Label records are standard.
  24.        01  ICF-Record.
  25.            Copy DDS-All-Formats Of ECHOICF.
  26.  
  27.        Working-Storage Section.
  28.  
  29.       * Feedback for ICFF.
  30.        01  ICF-FD-Status         Pic X(02).
  31.        01  ICF-Major-Minor-Code  Pic X(04).
  32.        01  ICF-Read-Rcd-Fmt      Pic X(10)  Value 'RCVRCD'.
  33.        01  ICF-Write-Rcd-Fmt     Pic X(10)  Value 'SNDRCD'.
  34.        01  ICF-Device            Pic X(10)  Value 'ECHOICF'.
  35.  
  36.       * Indicators.
  37.        01  Indics.
  38.            03  Ind Pic 1(1) Occurs 99 Indicator 1.
  39.            88  C-Indicator-On Value B'1'.
  40.            88  C-Indicator-OFF Value B'0'.
  41.  
  42.        01  ADDLIBLE-Cmd.
  43.            02  Filler             PIC X(9) VALUE 'ADDLIBLE '.
  44.            02  ADDLIBLE-Lib       Pic X(10).
  45.        01  ADDLIBLE-Cmd-Len       PIC S9(10)V9(5) COMP-3 VALUE 19.
  46.  
  47.  
  48.  
  49.       * Received record format.
  50.        01 ReceivedRecord.
  51.           02 ReceivedLen                  Pic 9(02) COMP-4.
  52.           02 ReceivedData                 Pic X(32758).
  53.  
  54.        Linkage Section.
  55.        01 Product-Library Pic X(10).
  56.  
  57.       *****************************************************************
  58.        Procedure Division using Product-Library.
  59.       *****************************************************************
  60.        Sub-Main-Section Section.
  61.  
  62.        Sub-Main.
  63.  
  64.  
  65.       *---------------------------------------------------------------*
  66.       * Set up the library list so that run time objects can be found.*
  67.       *---------------------------------------------------------------*
  68.            Move Product-Library TO ADDLIBLE-Lib.
  69.            Call 'QCMDEXC' Using ADDLIBLE-Cmd ADDLIBLE-Cmd-Len.
  70.  
  71.  
  72.       *---------------------------------------------------------------*
  73.       * Open ICF file and acquire device.                             *
  74.       *---------------------------------------------------------------*
  75.            Open I-O ICF.
  76.            Acquire ICF-Device for ICF.
  77.  
  78.       *---------------------------------------------------------------*
  79.       * Initial "priming" read.                                       *
  80.       *---------------------------------------------------------------*
  81.            Read ICF
  82.                 Format is ICF-Read-Rcd-Fmt
  83.                 Indicators are Indics.
  84.  
  85.       *---------------------------------------------------------------*
  86.       * Loop until the PC issues an Deallocate command which will     *
  87.       * set indicator 82 on, or until indicator 66 (receive failed)   *
  88.       * is set on.                                                    *
  89.       *---------------------------------------------------------------*
  90.            Perform Process-Request thru Process-Request-Exit
  91.                                    until C-Indicator-On(82)
  92.                                    or C-Indicator-On(66).
  93.       *---------------------------------------------------------------*
  94.       * Drop ICF Device.                                              *
  95.       *---------------------------------------------------------------*
  96.            Drop ICF-Device from ICF.
  97.  
  98.            Close ICF.
  99.  
  100.            Exit Program.
  101.            Stop Run.
  102.  
  103.  
  104.       *****************************************************************
  105.        Subroutine Section.
  106.       *****************************************************************
  107.  
  108.       *****************************************************************
  109.       * Subroutine - Process-Reequest.                                *
  110.       *****************************************************************
  111.        Process-Request.
  112.  
  113.       * Set the length of the output buffer to be the received len
  114.       * and move the input data to the output data (echo back what
  115.       * was received).
  116.            Move RCVDATA of RCVRCD-I to ReceivedRecord
  117.            Compute SNDLEN of SNDRCD-O = ReceivedLen.
  118.            Move RCVDATA of RCVRCD-I to SNDDATA of SNDRCD-O.
  119.  
  120.  
  121.            Write ICF-RECORD
  122.               Format is ICF-Write-Rcd-Fmt.
  123.  
  124.            Read ICF
  125.               Format is ICF-Read-Rcd-Fmt
  126.               Indicators are Indics.
  127.  
  128.  
  129.        Process-Request-Exit. Exit.
  130.  
  131.